#ifndef _MODULEBASEUTIL_H
#define _MODULEBASEUTIL_H
#include <math.h>

namespace module_base
{
struct VehicleParam
{
	float back_edge_to_center; //车尾到后轴中心
	float kinpain;
	float v_length; //拖头长度
	float v_width; //拖头宽度
	float min_turn_radius;
	float max_acceleration;
	float max_deceleration;
	float max_steer_angle;  //轮子最大转向 35度 弧度
	float max_steer_angle_rate;
	float wheel_base;
	float wheel_base2;
	float hitch_v; //绞点到车辆后轴中心的距离。在前轴与后轴之间为负，在后轴之后为正

	float t_length;
	float t_width;
	float hitch_t; //绞点到托挂后轴的距离
	float back_edge_to_center_t; //托挂尾到托挂后轴中心
	float max_angle_tractor_trailer; //拖头与托挂之间的角度，90度 弧度，
	float wheel_radius;
	float wheel_width;
};

struct Location
{
	double stamp;
	float x;
	float y;
	float yaw;
	float omega;
	Location()
	{
		x=0;
		y=0;
		yaw=0;
		omega=0;
	}
	Location(double _stamp,float _x, float _y, float _yaw)
	{
		stamp=_stamp;
		x=_x;
		y=_y;
		yaw=_yaw;
	}
	Location(float _x, float _y, float _yaw, float _omega)
	{
		x=_x;
		y=_y;
		yaw=_yaw;
		omega=_omega;
	}
	Location(double _stamp)
	{
		stamp=_stamp;
	}
	void set_omega(float _omega)
	{
		omega=_omega;
	}

	void set_yaw(float _yaw)
	{
		yaw=_yaw;
	}

	void set_xy(float _x, float _y)
	{
		x=_x;
		y=_y;
	}

	void set_loc(float _x, float _y, float _yaw)
	{
		x=_x;
		y=_y;
		yaw=_yaw;
	}

	void set_stamp(double _stamp)
	{
		stamp=_stamp;
	}

	bool is_equal(const Location &loc)
	{
		if (x==loc.x && y==loc.y && yaw==loc.yaw)
		{
			return true;
		}
		else
		{
			return false;
		}
	}
};

struct Line
{
	float k;
	float b;
	int direction; //-1 x=k*y+b  1 y=k*x+b
	Line()
	{
		k=0;
		b=0;
		direction=1;
	}
	Line(float _k,float _b)
	{
		k=_k;
		b=_b;
	}
};

struct Velocity
{
	double stamp;
	float x;
	float y;
	float vx;
	float vy;
	float yaw;
	float omega;
	Velocity()
	{
		x=0.0;
		y=0.0;
		vx=0.0;
		vy=0.0;
		yaw=0.0;
		omega=0.0;
		stamp=0.0;
	}
	float get_v()
	{
		return sqrt(vx*vx+vy*vy);
	}
};

}//namespace


#endif